<?php

class WSB_View_Helper_Icon
{

    public function icon($filename, $alt='', $attributes=array())
    {
		$src = sprintf('../WSB/design/default/skin/default/icon/%s', $filename);
    	return sprintf('<img src="%s" width="16" height="16" alt="%s" border="0"%s />',
    		$src,
    		$alt,
    		$this->_getAttributesAsString($attributes)
    	);
    }

    private function _getAttributesAsString($attributes)
	{
    	$str = '';
		foreach($attributes AS $key=>$value) {
			$str .= sprintf(' %s="%s"', $key, $value);
		}
		return $str;
    }

}
